<?php
    //加载初始化文件
    include_once('init.php');

    //获取地址栏中参数名是id的值
 	$id = $_GET['id'];

    $sql = "delete from `news` where `id` = $id";

    //执行语句
    mysqli_query($link,$sql);

    //获取刚刚执行的添加语句受影响的行数(就是你插入的数据的记录总数)
    $_rows = mysqli_affected_rows($link);

    if($_rows>0){
       echo '<script>alert("删除成功");location.href="news_list.php";</script>';die;
    }else{
        echo '<script>alert("删除失败");history.go(-1);</script>';die;
    }